var e = require;
var t = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("BaseModuleUI"),
    a = e("GlobalParams"),
    i = e("CommonHelper"),
    r = e("UIManager"),
    s = e("BigAdNative"),
    l = e("sdkConfig"),
    c = e("AD"),
    d = cc._decorator,
    h = d.ccclass,
    _ = d.property,
    u = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.shop_top_content = null),
                (t.native_node = null),
                (t.banner_index = 0),
                (t.max_banner = 0),
                (t.uiManager = null),
                t
            );
        }
        return (
            __extends(t, e),
            (t.prototype.initView = function () {
                var e = this;
                (this.uiManager = cc.find("UIManager").getComponent(r.default)),
                    (this.max_banner = this.shop_top_content.childrenCount - 1),
                    l.default.platform == l.EPlatform.No_AD || c.default.getInstance().getGameTestVersion()
                        ? ((this.native_node.active = !1), (this.max_banner -= 1))
                        : (this.native_node.getComponent(s.default).showNativeCall(function () {
                              (e.max_banner = 3), e.unscheduleAllCallbacks(), e.updateBannerInfo();
                          }),
                          (this.native_node.active = !0)),
                    (this.banner_index = i.default.getRandomInt(0, this.max_banner));
                for (var t = 0; t < this.shop_top_content.childrenCount; t++)
                    this.shop_top_content.children[t].x = this.banner_index == t ? 0 : 978;
                this.scheduleOnce(function () {
                    e.updateBannerInfo();
                }, 5),
                    this.node.on("click", this.showTopInfo, this);
            }),
            (t.prototype.updateBannerInfo = function () {
                var e = this,
                    t = this.banner_index;
                this.banner_index++,
                    this.banner_index > this.max_banner && (this.banner_index = 0),
                    cc
                        .tween(this.shop_top_content.children[t])
                        .to(0.5, {position: cc.v3(-978, 0, 0)})
                        .call(function () {
                            e.shop_top_content.children[t].x = 978;
                        })
                        .start(),
                    cc
                        .tween(this.shop_top_content.children[this.banner_index])
                        .to(0.5, {position: cc.v3(0, 0, 0)})
                        .call(function () {
                            e.scheduleOnce(function () {
                                e.updateBannerInfo();
                            }, 5);
                        })
                        .start();
            }),
            (t.prototype.showTopInfo = function () {
                0 == this.banner_index
                    ? this.uiManager.showPopup("TaskViewUI")
                    : 1 == this.banner_index
                    ? ((a.GlobalParams.ChangeGameMode = 2), this.uiManager.showPopup("MatchViewUI"))
                    : 2 == this.banner_index
                    ? this.uiManager.showPopup("DowerViewUI")
                    : 3 == this.banner_index &&
                      ((a.GlobalParams.ChangeGameMode = 0), this.uiManager.showPopup("MatchViewUI"));
            }),
            __decorate([_(cc.Node)], t.prototype, "shop_top_content", void 0),
            __decorate([_(cc.Node)], t.prototype, "native_node", void 0),
            __decorate([h], t)
        );
    })(n.default);
o.default = u;
